package com.lvxh.exp.utils;

import java.util.List;

import com.lvxh.exp.bean.TableProperties;

public class StringUtil
{

    public static String headToLowercase(String str)
    {
        return str.substring(0, 1).toLowerCase() + str.substring(1);
    }

    public static String headToUpperCase(String str)
    {
        return str.substring(0, 1).toUpperCase() + str.substring(1);
    }

    public static String jsp = "<%@ page language=\"java\" contentType=\"text/html; charset=UTF-8\" pageEncoding=\"UTF-8\"%>                                                                               \n"
            + "<%@ include file=\"/decorators/taglib.jsp\"%>                                                                                                                             \n"
            + "<script>                                                                                                                                                                  \n"
            + "      var jsonMyPagination;                                                                                                                                               \n"
            + "    var myparams;                                                                                                                                                         \n"
            + "      $(function()                                                                                                                                                        \n"
            + "     {                                                                                                                                                                    \n"
            + "          $(\"#expaccordion\").accordion(                                                                                                                                 \n"
            + "          {                                                                                                                                                               \n"
            + "              header: \"h3\"                                                                                                                                              \n"
            + "          });                                                                                                                                                             \n"
            + "          init();                                                                                                                                                         \n"
            + "          initEvent();                                                                                                                                                    \n"
            + "          $('.button').button();                                                                                                                                          \n"
            + "      })                                                                                                                                                                  \n"
            + "     function init()                                                                                                                                                      \n"
            + "     {                                                                                                                                                                    \n"
            + "         $(\":text:first\").focus();                                                                                                                                      \n"
            + "       }                                                                                                                                                                  \n"
            + "       function initEvent()                                                                                                                                               \n"
            + "     {                                                                                                                                                                    \n"
            + "          jsonMyPagination = $(\"#expdatagrid\").myPagination(                                                                                                            \n"
            + "          {                                                                                                                                                               \n"
            + "              cssStyle: \"exp\",                                                                                                                                          \n"
            + "              panel:                                                                                                                                                      \n"
            + "                  {                                                                                                                                                       \n"
            + "                      tipInfo_on: true,                                                                                                                                   \n"
            + "                      tipInfo: '&nbsp;&nbsp;跳{input}/{sumPage}页',                                                                                                       \n"
            + "                      tipInfo_css:                                                                                                                                        \n"
            + "                          {                                                                                                                                               \n"
            + "                            width: '25px',                                                                                                                                \n"
            + "                            height: \"20px\",                                                                                                                             \n"
            + "                            border: \"2px solid #f0f0f0\",                                                                                                                \n"
            + "                            padding: \"0 0 0 5px\",                                                                                                                       \n"
            + "                            margin: \"0 5px 0 5px\",                                                                                                                      \n"
            + "                            color: \"#666\"                                                                                                                               \n"
            + "                          }                                                                                                                                               \n"
            + "                  },                                                                                                                                                      \n"
            + "              debug: false,                                                                                                                                               \n"
            + "               ajax:                                                                                                                                                      \n"
            + "                  {                                                                                                                                                       \n"
            + "                      on: true,                                                                                                                                           \n"
            + "                      url: '<c:url value=\"";

    public static String jsp1 = "\"/>',                                                                                             \n"
            + "                      dataType: 'json',                                                                                                                                   \n"
            + "                      param: myparams,                                                                                                                                    \n"
            + "                      ajaxStart: function()                                                                                                                               \n"
            + "                          {                                                                                                                                               \n"
            + "                              ZENG.msgbox.show(\" 正在加载中，请稍后...\", 6, 10000);                                                                                     \n"
            + "                          },                                                                                                                                              \n"
            + "                      ajaxStop: function()                                                                                                                                \n"
            + "                          {                                                                                                                                               \n"
            + "                            //隐藏加载提示                                                                                                                                \n"
            + "                            setTimeout(function()                                                                                                                         \n"
            + "                              {                                                                                                                                           \n"
            + "                                  ZENG.msgbox.hide();                                                                                                                     \n"
            + "                              }, 120000);                                                                                                                                 \n"
            + "                          },                                                                                                                                              \n"
            + "                      callback: function(data)                                                                                                                            \n"
            + "                          {                                                                                                                                               \n"
            + "                                                                                                                                                                          \n"
            + "                               $(\"#mytab tbody\").setTemplateElement(\"Template-List\").processTemplate(data);                                                           \n"
            + "                               $('#mytab tbody').addClass('TrHover');                                                                                                     \n"
            + "                               $(\"#mytab tbody tr\").addClass(\"odd\");                                                                                                  \n"
            + "                               $(\"#mytab tbody tr:even\").addClass(\"even\");                                                                                            \n"
            + "                               $('#mytab tbody tr').click(function()                                                                                                      \n"
            + "                                {                                                                                                                                         \n"
            + "                                    $(\".Expselected\").removeClass(\"Expselected\");                                                                                     \n"
            + "                                    $(this).toggleClass(\"Expselected\");                                                                                                 \n"
            + "                                });                                                                                                                                       \n"
            + "                                ZENG.msgbox.hide();                                                                                                                       \n"
            + "                          }                                                                                                                                               \n"
            + "                }                                                                                                                                                         \n"
            + "          });                                                                                                                                                             \n"
            + "                                                                                                                                                                          \n"
            + "      }                                                                                                                                                                   \n"
            + "   function info(str)                                                                                                                                                     \n"
            + "   {                                                                                                                                                                      \n"
            + "    alert(str);                                                                                                                                                           \n"
            + "   }                                                                                                                                                                      \n"
            + "                                                                                                                                                                          \n"
            + "    function query()                                                                                                                                                      \n"
            + "          {                                                                                                                                                               \n"
            + "            var params = $(\"#queryForm\").serialize();                                                                                                                   \n"
            + "            params = decodeURI(params);                                                                                                                                   \n"
            + "            myparams = params;                                                                                                                                            \n"
            + "            initEvent();                                                                                                                                                  \n"
            + "          }                                                                                                                                                               \n"
            + "      function add()                                                                                                                                                      \n"
            + "  {                                                                                                                                                                       \n"
            + "   alert(\"add\");                                                                                                                                                        \n"
            + "  }                                                                                                                                                                       \n"
            + "      function del()                                                                                                                                                      \n"
            + "  {                                                                                                                                                                       \n"
            + "   alert(\"delete\");                                                                                                                                                     \n"
            + "  }                                                                                                                                                                       \n"
            + "    </script>                                                                                                                                                             \n"
            + "</head>                                                                                                                                                                   \n"
            + "<body>                                                                                                                                                                    \n"
            + "  <form id=\"queryForm\" name=\"queryForm\" method=\"post\" action=\"\">                                                                                                                  \n"
            + "  <table width=\"100%\" id=\"tab\">                                                                                                                                       \n"
            + "    <thead >                                                                                                                                                              \n"
            + "      <tr>                                                                                                                                                                \n"
            + "        <th colspan=\"6\" style=\"font-size:15px;    text-align: left;\">查询条件</th>                                                                                    \n"
            + "      </tr>                                                                                                                                                               \n"
            + "    </thead>                                                                                                                                                              \n"
            + "    <tbody>                                                                                                                                                               \n"
            + "      <tr>                                                                                                                                                                \n"
            + "        <td class=\"one\">";

    public static String jsp2 = "</td>                                                                                                                                  \n"
            + "        <td colspan=\"2\" class=\"two\"><input type=\"text\"";

    public static String jsp3 = "  class=\"three\" value=\"\" /></td>                                          \n"
            + "        <td colspan=\"3\">                                                                                                                                                \n"
            + "          <input type=\"button\" class=\"button\" value=\"查询\" onclick=\"query();\"/>&nbsp;                                                                             \n"
            + "          <input type=\"button\" class=\"button\" value=\"增加\" onclick=\"add();\"/>&nbsp;                                                                               \n"
            + "          <input type=\"button\" class=\"button\" value=\"删除\" onclick=\"del();\"/>                                                                                     \n"
            + "          <input type=\"reset\" class=\"button\" value=\"重置\" />                                                                                                        \n"
            + "      </td>                                                                                                                                                               \n"
            + "      </tr>                                                                                                                                                             \n";

    public static String jsp4 = ""
            + "                                                                                                                                                                          \n"
            + "    </tbody>                                                                                                                                                              \n"
            + "  </table>                                                                                                                                                                \n"
            + "</form>                                                                                                                                                                   \n"
            + "  <table width=\"100%\" id=\"mytab\" class=\"t1\">                                                                                                                        \n"
            + "      <thead>                                                                                                                                                             \n";

    public static String jsp5 = ""
            + "      </thead>                                                                                                                                                            \n"
            + "      <tbody>                                                                                                                                                             \n"
            + "      </tbody>                                                                                                                                                            \n"
            + "  </table>                                                                                                                                                                \n"
            + "  <div id=\"expdatagrid\"></div>                                                                                                                                          \n"
            + "  <!-- Templates -->                                                                                                                                                      \n"
            + "  <p style=\"display:none\">                                                                                                                                              \n"
            + "      <textarea id=\"Template-List\" rows=\"0\" cols=\"0\">                                                                                                               \n"
            + "        <!--                                                                                                                                                              \n"
            + "          {#template MAIN}                                                                                                                                                \n"
            + "              {#foreach $T.result as Result}                                                                                                                              \n";

    public static String jsp6 = "              {#/for}                                                                                                                                                     \n"
            + "          {#/template MAIN}                                                                                                                                               \n"
            + "        -->                                                                                                                                                               \n"
            + "      </textarea>                                                                                                                                                         \n"
            + "  </p>                                                                                                                                                                    \n"
            + "</body>                                                                                                                                                                   \n"
            + "</html>                                                                                                                                                                   \n";
    public static String getFram(String script,String body)
    {
        StringBuffer buf = new StringBuffer();
        //文件头
        buf.append("<%@ page language=\"java\" contentType=\"text/html; charset=UTF-8\" pageEncoding=\"UTF-8\"%> ");
        buf.append(System.getProperty("line.separator"));
        buf.append("<%@ include file=\"/decorators/taglib.jsp\"%>");
        buf.append(System.getProperty("line.separator"));
        buf.append("<html>");
        buf.append(System.getProperty("line.separator"));
        
        //script脚本
        buf.append("<script language=\"javascript\"> ");
        buf.append(System.getProperty("line.separator"));
        buf.append(script);
        buf.append(System.getProperty("line.separator"));
        buf.append("</script>");
        buf.append(System.getProperty("line.separator"));
        
        //body体       
        buf.append("<body>");
        buf.append(System.getProperty("line.separator"));
        buf.append(body);
        buf.append(System.getProperty("line.separator"));
        buf.append("</body>");
        buf.append(System.getProperty("line.separator"));
        buf.append("</html>");
        buf.append(System.getProperty("line.separator"));
        
        return buf.toString();
        
    }
    
    public static String getQueryScript(String tableName)
    {
        StringBuffer buf = new StringBuffer();
        
        buf.append("    var jsonMyPagination;");
        buf.append(System.getProperty("line.separator"));
        buf.append("    var myparams; ");
        buf.append(System.getProperty("line.separator"));
        buf.append("    $(function()         ");
        buf.append(System.getProperty("line.separator"));
        buf.append("        {    ");
        buf.append(System.getProperty("line.separator"));
        buf.append("            $(\"#expaccordion\").accordion(     ");
        buf.append(System.getProperty("line.separator"));
        buf.append("            {                ");
        buf.append(System.getProperty("line.separator"));
        buf.append("                header: \"h3\"                                                              ");
        buf.append(System.getProperty("line.separator"));
        buf.append("            });              ");
        buf.append(System.getProperty("line.separator"));
        buf.append("            $(\":text:first\").focus();              ");
        buf.append(System.getProperty("line.separator"));
        buf.append("            initEvent();     ");
        buf.append(System.getProperty("line.separator"));
        buf.append("            $('.ui-button-exp').button();  ");
        buf.append(System.getProperty("line.separator"));
        buf.append("            var likebox=$(\":checkbox[name=listcheck]\");");
        buf.append(System.getProperty("line.separator"));
        buf.append("            var allcheck=$(\":checkbox[name=allcheck]\");");
        buf.append(System.getProperty("line.separator"));
        buf.append("            ");
        buf.append(System.getProperty("line.separator"));
        buf.append("    ");
        buf.append(System.getProperty("line.separator"));
        buf.append("            $(allcheck).bind(\"click\",function()");
        buf.append(System.getProperty("line.separator"));
        buf.append("            {");
        buf.append(System.getProperty("line.separator"));
        buf.append("                if($(allcheck).attr(\"checked\"))");
        buf.append(System.getProperty("line.separator"));
        buf.append("                {");
        buf.append(System.getProperty("line.separator"));
        buf.append("                    $(\":checkbox[name=listcheck]\").each(function(){");
        buf.append(System.getProperty("line.separator"));
        buf.append("                        $(this).attr(\"checked\",true);");
        buf.append(System.getProperty("line.separator"));
        buf.append("                    });");
        buf.append(System.getProperty("line.separator"));
        buf.append("                }");
        buf.append(System.getProperty("line.separator"));
        buf.append("                else");
        buf.append(System.getProperty("line.separator"));
        buf.append("                {");
        buf.append(System.getProperty("line.separator"));
        buf.append("                    $(\":checkbox[name=listcheck]\").each(function(){");
        buf.append(System.getProperty("line.separator"));
        buf.append("                        $(this).attr(\"checked\",false);");
        buf.append(System.getProperty("line.separator"));
        buf.append("                    });");
        buf.append(System.getProperty("line.separator"));
        buf.append("                }");
        buf.append(System.getProperty("line.separator"));
        buf.append("            }); ");
        buf.append(System.getProperty("line.separator"));
        buf.append("        });    ");
        buf.append(System.getProperty("line.separator"));
        buf.append("    $(document).ready(function() ");
        buf.append(System.getProperty("line.separator"));
        buf.append("    {");
        buf.append(System.getProperty("line.separator"));
        buf.append("        $(\"#queryForm\").validationEngine('attach', ");
        buf.append(System.getProperty("line.separator"));
        buf.append("        {");
        buf.append(System.getProperty("line.separator"));
        buf.append("            bindMethod:\"live\",");
        buf.append(System.getProperty("line.separator"));
        buf.append("            onValidationComplete: function(form, status)");
        buf.append(System.getProperty("line.separator"));
        buf.append("            {");
        buf.append(System.getProperty("line.separator"));
        buf.append("                if(status)");
        buf.append(System.getProperty("line.separator"));
        buf.append("                    {");
        buf.append(System.getProperty("line.separator"));
        buf.append("                    var params = $(\"#queryForm\").serialize();                                   ");
        buf.append(System.getProperty("line.separator"));
        buf.append("                    params = decodeURI(params);                                                   ");
        buf.append(System.getProperty("line.separator"));
        buf.append("                    myparams = params;  ");
        buf.append(System.getProperty("line.separator"));
        buf.append("                    initEvent();  ");
        buf.append(System.getProperty("line.separator"));
        buf.append("                    }");
        buf.append(System.getProperty("line.separator"));
        buf.append("            }");
        buf.append(System.getProperty("line.separator"));
        buf.append("        })");
        buf.append(System.getProperty("line.separator"));
        buf.append("    });          ");
        buf.append(System.getProperty("line.separator"));
        buf.append("    function initEvent()");
        buf.append(System.getProperty("line.separator"));
        buf.append("    {    ");
        buf.append(System.getProperty("line.separator"));
        buf.append("            jsonMyPagination = $(\"#expdatagrid\").myPagination(                            ");
        buf.append(System.getProperty("line.separator"));
        buf.append("            {                ");
        buf.append(System.getProperty("line.separator"));
        buf.append("                cssStyle: \"exp\",                                                          ");
        buf.append(System.getProperty("line.separator"));
        buf.append("                panel:       ");
        buf.append(System.getProperty("line.separator"));
        buf.append("                    {        ");
        buf.append(System.getProperty("line.separator"));
        buf.append("                        tipInfo_on: true,                                                   ");
        buf.append(System.getProperty("line.separator"));
        buf.append("                        tipInfo: '&nbsp;&nbsp;跳{input}/{sumPage}页',                       ");
        buf.append(System.getProperty("line.separator"));
        buf.append("                        tipInfo_css:                                                        ");
        buf.append(System.getProperty("line.separator"));
        buf.append("                            {");
        buf.append(System.getProperty("line.separator"));
        buf.append("                                width: '25px',                                                ");
        buf.append(System.getProperty("line.separator"));
        buf.append("                                height: \"20px\",                                             ");
        buf.append(System.getProperty("line.separator"));
        buf.append("                                border: \"2px solid #f0f0f0\",                                ");
        buf.append(System.getProperty("line.separator"));
        buf.append("                                padding: \"0 0 0 5px\",                                       ");
        buf.append(System.getProperty("line.separator"));
        buf.append("                                margin: \"0 5px 0 5px\",                                      ");
        buf.append(System.getProperty("line.separator"));
        buf.append("                                color: \"#666\"");
        buf.append(System.getProperty("line.separator"));
        buf.append("                            }");
        buf.append(System.getProperty("line.separator"));
        buf.append("                    },       ");
        buf.append(System.getProperty("line.separator"));
        buf.append("                debug: false,");
        buf.append(System.getProperty("line.separator"));
        buf.append("                ajax:       ");
        buf.append(System.getProperty("line.separator"));
        buf.append("                   {        ");
        buf.append(System.getProperty("line.separator"));
        buf.append("                        on: true,                                                           ");
        buf.append(System.getProperty("line.separator"));
        buf.append("                        url: '<c:url value=\"/"+tableName+"/getGrid.action\"/>',             ");
        buf.append(System.getProperty("line.separator"));
        buf.append("                        dataType: 'json',                                                   ");
        buf.append(System.getProperty("line.separator"));
        buf.append("                        param: myparams,                                                    ");
        buf.append(System.getProperty("line.separator"));
        buf.append("                        ajaxStart: function()                                               ");
        buf.append(System.getProperty("line.separator"));
        buf.append("                           {");
        buf.append(System.getProperty("line.separator"));
        buf.append("                               ZENG.msgbox.show(\" 正在加载中，请稍后...\", 6, 10000);     ");
        buf.append(System.getProperty("line.separator"));
        buf.append("                           },                                                              ");
        buf.append(System.getProperty("line.separator"));
        buf.append("                        ajaxStop: function()                                                ");
        buf.append(System.getProperty("line.separator"));
        buf.append("                            { ");
        buf.append(System.getProperty("line.separator"));
        buf.append("                                setTimeout(function()                                         ");
        buf.append(System.getProperty("line.separator"));
        buf.append("                                  {                                                           ");
        buf.append(System.getProperty("line.separator"));
        buf.append("                                      ZENG.msgbox.hide();                                     ");
        buf.append(System.getProperty("line.separator"));
        buf.append("                                  }, 120000);                                                 ");
        buf.append(System.getProperty("line.separator"));
        buf.append("                            },                                                              ");
        buf.append(System.getProperty("line.separator"));
        buf.append("                        callback: function(data)                                            ");
        buf.append(System.getProperty("line.separator"));
        buf.append("                            {");
        buf.append(System.getProperty("line.separator"));
        buf.append("          ");
        buf.append(System.getProperty("line.separator"));
        buf.append("                               $(\"#mytab tbody\").setTemplateElement(\"Template-List\").processTemplate(data);                                                           ");
        buf.append(System.getProperty("line.separator"));
        buf.append("                               $('#mytab tbody').addClass('TrHover');                     ");
        buf.append(System.getProperty("line.separator"));
        buf.append("                               $(\"#mytab tbody tr\").addClass(\"odd\");                  ");
        buf.append(System.getProperty("line.separator"));
        buf.append("                               $(\"#mytab tbody tr:even\").addClass(\"even\");            ");
        buf.append(System.getProperty("line.separator"));
        buf.append("                               $('#mytab tbody tr').click(function()                      ");
        buf.append(System.getProperty("line.separator"));
        buf.append("                                    {                                                         ");
        buf.append(System.getProperty("line.separator"));
        buf.append("                                        $(\".Expselected\").removeClass(\"Expselected\");     ");
        buf.append(System.getProperty("line.separator"));
        buf.append("                                        $(this).toggleClass(\"Expselected\");                 ");
        buf.append(System.getProperty("line.separator"));
        buf.append("                                    });                                                       ");
        buf.append(System.getProperty("line.separator"));
        buf.append("                                ZENG.msgbox.hide();                                       ");
        buf.append(System.getProperty("line.separator"));
        buf.append("                            }");
        buf.append(System.getProperty("line.separator"));
        buf.append("                }          ");
        buf.append(System.getProperty("line.separator"));
        buf.append("          });             ");
        buf.append(System.getProperty("line.separator"));
        buf.append("    }               ");
        buf.append(System.getProperty("line.separator"));
        buf.append("    function query()       ");
        buf.append(System.getProperty("line.separator"));
        buf.append("          {                ");
        buf.append(System.getProperty("line.separator"));
        buf.append("            $(\"#queryForm\").submit();     ");
        buf.append(System.getProperty("line.separator"));
        buf.append("          }                ");
        buf.append(System.getProperty("line.separator"));
        buf.append("    function add()       ");
        buf.append(System.getProperty("line.separator"));
        buf.append("    {  ");
        buf.append(System.getProperty("line.separator"));
        buf.append("        $(\"#expParamForm\").attr(\"action\",\"<c:url value=\"/"+tableName+"/initadd.action\"/>\");");
        buf.append(System.getProperty("line.separator"));
        buf.append("        $(\"#expParamForm\").submit();");
        buf.append(System.getProperty("line.separator"));
        buf.append("    }       ");
        buf.append(System.getProperty("line.separator"));
        buf.append("    function delall()       ");
        buf.append(System.getProperty("line.separator"));
        buf.append("    {  ");
        buf.append(System.getProperty("line.separator"));
        buf.append("        var delId = \"\";  ");
        buf.append(System.getProperty("line.separator"));
        buf.append("        $(\":checkbox[name=listcheck]\").each(function()");
        buf.append(System.getProperty("line.separator"));
        buf.append("        {");
        buf.append(System.getProperty("line.separator"));
        buf.append("            if($(this).attr(\"checked\"))");
        buf.append(System.getProperty("line.separator"));
        buf.append("            {");
        buf.append(System.getProperty("line.separator"));
        buf.append("               delId=delId+\"|\"+$(this).val();");
        buf.append(System.getProperty("line.separator"));
        buf.append("            }");
        buf.append(System.getProperty("line.separator"));
        buf.append("        });  ");
        buf.append(System.getProperty("line.separator"));
        buf.append("        if(delId == \"\")");
        buf.append(System.getProperty("line.separator"));
        buf.append("        {");
        buf.append(System.getProperty("line.separator"));
        buf.append("         alert(\"请选择需要删除的记录！\");");
        buf.append(System.getProperty("line.separator"));
        buf.append("        }");
        buf.append(System.getProperty("line.separator"));
        buf.append("        else");
        buf.append(System.getProperty("line.separator"));
        buf.append("        {");
        buf.append(System.getProperty("line.separator"));
        buf.append("            $(\"#delFlag\").val(delId);");
        buf.append(System.getProperty("line.separator"));
        buf.append("            $(\"#expParamForm\").attr(\"action\",\"<c:url value=\"/"+tableName+"/delall.action\"/>\");");
        buf.append(System.getProperty("line.separator"));
        buf.append("            $(\"#expParamForm\").submit();      ");
        buf.append(System.getProperty("line.separator"));
        buf.append("        }       ");
        buf.append(System.getProperty("line.separator"));
        buf.append("    }    ");
        buf.append(System.getProperty("line.separator"));
        buf.append("    function del(id)       ");
        buf.append(System.getProperty("line.separator"));
        buf.append("    {  ");
        buf.append(System.getProperty("line.separator"));
        buf.append("        var delId = \"|\"+id;  ");
        buf.append(System.getProperty("line.separator"));
        buf.append("        $(\"#delFlag\").val(delId);");
        buf.append(System.getProperty("line.separator"));
        buf.append("        $(\"#expParamForm\").attr(\"action\",\"<c:url value=\"/"+tableName+"/del.action\"/>\");");
        buf.append(System.getProperty("line.separator"));
        buf.append("        $(\"#expParamForm\").submit();          ");
        buf.append(System.getProperty("line.separator"));
        buf.append("    }   ");
        buf.append(System.getProperty("line.separator"));
        buf.append("    function modify(id)       ");
        buf.append(System.getProperty("line.separator"));
        buf.append("        {  ");
        buf.append(System.getProperty("line.separator"));
        buf.append("            $(\"#delFlag\").val(id);");
        buf.append(System.getProperty("line.separator"));
        buf.append("            $(\"#expParamForm\").attr(\"action\",\"<c:url value=\"/"+tableName+"/initmodify.action\"/>\");");
        buf.append(System.getProperty("line.separator"));
        buf.append("            $(\"#expParamForm\").submit();          ");
        buf.append(System.getProperty("line.separator"));
        buf.append("        }               ");
        buf.append(System.getProperty("line.separator"));
        
        return buf.toString();
    }
    
   

    public static String getQueryBody(String condition,String thead,String template)
    {
        StringBuffer buf = new StringBuffer();
        buf.append(System.getProperty("line.separator"));
        buf.append("    <form id=\"expParamForm\" name=\"expParamForm\" method=\"post\" action=\"\">  ");
        buf.append(System.getProperty("line.separator"));
        buf.append("        <input type=\"hidden\" id=\"delFlag\" name=\"delFlag\" />  ");
        buf.append(System.getProperty("line.separator"));
        buf.append("    </form>             ");
        buf.append(System.getProperty("line.separator"));
        buf.append("    <form id=\"queryForm\" name=\"queryForm\" method=\"post\" action=\"javascript:void(0);\"> ");
        buf.append(System.getProperty("line.separator"));
        buf.append("      <table width=\"100%\" id=\"tab\">                                                       ");
        buf.append(System.getProperty("line.separator"));
        buf.append("        <thead >               ");
        buf.append(System.getProperty("line.separator"));
        buf.append("          <tr>");
        buf.append(System.getProperty("line.separator"));
        buf.append("            <th colspan=\"6\" style=\"font-size:14px; text-shadow:700;    text-align: left;\">查询条件</th>    ");
        buf.append(System.getProperty("line.separator"));
        buf.append("          </tr>                ");
        buf.append(System.getProperty("line.separator"));
        buf.append("        </thead>               ");
        buf.append(System.getProperty("line.separator"));
        buf.append("        <tbody>                ");
        buf.append(System.getProperty("line.separator"));
        buf.append("          <tr>");
        buf.append(System.getProperty("line.separator"));
        buf.append("            <td class=\"one\">id:</td>                                                  ");
        buf.append(System.getProperty("line.separator"));
        buf.append("            <td colspan=\"2\" class=\"two\"><input class=\"validate[optional,custom[integer]]\" type=\"text\" id=\"id\" name=\"id\"  value=\"\" /></td>                                          ");
        buf.append(System.getProperty("line.separator"));
        buf.append("            <td colspan=\"3\" style=\"text-align: right;\"> ");
        buf.append(System.getProperty("line.separator"));
        buf.append("              <input type=\"button\" class=\"ui-button-exp\" value=\"查询\" onclick=\"query();\"/>&nbsp;              ");
        buf.append(System.getProperty("line.separator"));
        buf.append("              <input type=\"button\" class=\"ui-button-exp\" value=\"增加\" onclick=\"add();\"/>&nbsp;                ");
        buf.append(System.getProperty("line.separator"));
        buf.append("              <input type=\"button\" class=\"ui-button-exp\" value=\"删除\" onclick=\"delall();\"/>&nbsp;      ");
        buf.append(System.getProperty("line.separator"));
        buf.append("              <input type=\"reset\" class=\"ui-button-exp\" value=\"重置\" />&nbsp;                          ");
        buf.append(System.getProperty("line.separator"));
        buf.append("          </td>                ");
        buf.append(System.getProperty("line.separator"));
        buf.append("          </tr>              ");
        
        //查询条件
        buf.append(condition);
        buf.append(System.getProperty("line.separator"));
       
        
        buf.append(System.getProperty("line.separator"));
        buf.append("        </tbody>               ");
        buf.append(System.getProperty("line.separator"));
        buf.append("      </table>");
        buf.append(System.getProperty("line.separator"));
        buf.append("    </form>   ");
        buf.append(System.getProperty("line.separator"));
        buf.append("      <table width=\"100%\" id=\"mytab\" class=\"t1\">                                        ");
        buf.append(System.getProperty("line.separator"));
        buf.append("          <thead>  ");
        buf.append(System.getProperty("line.separator"));
        buf.append("            <th><input type=\"checkbox\" name=\"allcheck\" value=\"\"/></th>      ");
        buf.append(System.getProperty("line.separator"));
        buf.append("            <th>id</th>");
        buf.append(System.getProperty("line.separator"));   
        buf.append(thead);
        //buf.append(System.getProperty("line.separator"));
       
        buf.append(System.getProperty("line.separator"));
        buf.append("            <th width=\"60px;\">操作</th>");
        buf.append(System.getProperty("line.separator"));
        buf.append("          </thead>             ");
        buf.append(System.getProperty("line.separator"));
        buf.append("          <tbody>              ");
        buf.append(System.getProperty("line.separator"));
        buf.append("          </tbody>             ");
        buf.append(System.getProperty("line.separator"));
        buf.append("      </table>");
        buf.append(System.getProperty("line.separator"));
        buf.append("    <div id=\"expdatagrid\"></div>                                                          ");
        buf.append(System.getProperty("line.separator"));
        buf.append("    <!-- Templates -->       ");
        buf.append(System.getProperty("line.separator"));
        buf.append("    <p style=\"display:none\">                                                              ");
        buf.append(System.getProperty("line.separator"));
        buf.append("        <textarea id=\"Template-List\" rows=\"0\" cols=\"0\">                               ");
        buf.append(System.getProperty("line.separator"));
        buf.append("            <!--               ");
        buf.append(System.getProperty("line.separator"));
        buf.append("            {#template MAIN} ");
        buf.append(System.getProperty("line.separator"));
        buf.append("                {#foreach $T.result as Result}                                              ");
        buf.append(System.getProperty("line.separator"));
        buf.append("                    <tr>");
        buf.append(System.getProperty("line.separator"));
        buf.append("                      <td><input type=\"checkbox\" name=\"listcheck\" value=\"{$T.Result.id}\"/></td>");
        buf.append(System.getProperty("line.separator"));
        buf.append("                      <td>{$T.Result.id}</td>");
        buf.append(System.getProperty("line.separator"));
        
        buf.append(template);
        buf.append(System.getProperty("line.separator"));
        
        
        buf.append(System.getProperty("line.separator"));
        buf.append("                      <td><a href=\"#\" onclick=\"del({$T.Result.id})\">删除</a>&nbsp;<a href=\"#\" onclick=\"modify({$T.Result.id})\">修改</a></td>");
        buf.append(System.getProperty("line.separator"));
        buf.append("                    </tr>              ");
        buf.append(System.getProperty("line.separator"));
        buf.append("                {#/for}      ");
        buf.append(System.getProperty("line.separator"));
        buf.append("            {#/template MAIN}");
        buf.append(System.getProperty("line.separator"));
        buf.append("            -->                ");
        buf.append(System.getProperty("line.separator"));
        buf.append("        </textarea>          ");
        buf.append(System.getProperty("line.separator"));
        buf.append("    </p>    ");
        buf.append(System.getProperty("line.separator"));
        
        
        
        return buf.toString();
        
    }
    
    public static String getQueryCondition(List<TableProperties> list)
    {
        StringBuffer buf = new StringBuffer();
        for(int i=1;i<list.size();i++)
        {
            if(i%2 != 0)
            {
                buf.append(System.getProperty("line.separator"));
                buf.append("         <tr class=\"tr_edd\">");
            }
            buf.append(System.getProperty("line.separator"));
            buf.append("           <td class=\"one\">"+list.get(i).getField()+":</td>");
            buf.append(System.getProperty("line.separator"));
            buf.append("           <td class=\"two\" colspan=\"2\">");
            buf.append(System.getProperty("line.separator"));
            buf.append("             <input type=\"text\" id=\""+list.get(i).getField()+"\" name=\""+list.get(i).getField()+"\" class=\"validate[optional]\" value=\"\" /></td>");
            buf.append(System.getProperty("line.separator"));
            if(i%2 == 0)
            {
                buf.append("         </tr>");
               
            }
        }
        if(!buf.toString().endsWith("</tr>"))
        {
            buf.append("         </tr>");
        }
        return buf.toString();
    }
    
    public static String getQueryThead(List<TableProperties> list)
    {
        StringBuffer buf = new StringBuffer();
        for(int i=1;i<list.size();i++)
        {
            buf.append("            <th>"+list.get(i).getField()+"</th>");
            buf.append(System.getProperty("line.separator"));
        }
       
        return buf.toString();
    }
    
    public static String getQueryTemplate(List<TableProperties> list)
    {
        StringBuffer buf = new StringBuffer();
        for(int i=1;i<list.size();i++)
        {
            buf.append("                      <td>{$T.Result."+list.get(i).getField()+"}</td>");
            buf.append(System.getProperty("line.separator"));
        }
       
        return buf.toString();
    }
    
    public static String getModifyScript(String tableName)
    {
        StringBuffer buf = new StringBuffer();
        buf.append(System.getProperty("line.separator"));
        buf.append("    $(function()");
        buf.append(System.getProperty("line.separator"));
        buf.append("    {");
        buf.append(System.getProperty("line.separator"));
        buf.append("      $(\"#queryForm\").validationEngine();");
        buf.append(System.getProperty("line.separator"));
        buf.append("      $('.ui-button-exp').button();");
        buf.append(System.getProperty("line.separator"));
        buf.append("    });");
        buf.append(System.getProperty("line.separator"));
        buf.append("    function save()");
        buf.append(System.getProperty("line.separator"));
        buf.append("    {");
        buf.append(System.getProperty("line.separator"));
        buf.append("     $(\"#queryForm\").attr(\"action\",\"<c:url value=\"/"+tableName+"/modify.action\"/>\");");
        buf.append(System.getProperty("line.separator"));
        buf.append("     $(\"#queryForm\").submit();");
        buf.append(System.getProperty("line.separator"));
        buf.append("    }");
        buf.append(System.getProperty("line.separator"));
        buf.append("    function cancle()");
        buf.append(System.getProperty("line.separator"));
        buf.append("    {");
        buf.append(System.getProperty("line.separator"));
        buf.append("     location.href = '<c:url value=\"init"+tableName+".action\"/>';");
        buf.append(System.getProperty("line.separator"));
        buf.append("    }                        ");
        buf.append(System.getProperty("line.separator"));
        
        return buf.toString();
    }
    
    public static String getModifyBody(String content)
    {
        StringBuffer buf = new StringBuffer();
        buf.append(System.getProperty("line.separator"));
        buf.append("      <form id=\"queryForm\" name=\"queryForm\" method=\"post\" action=\"\">  ");
        buf.append(System.getProperty("line.separator"));
        buf.append("          <table width=\"100%\" id=\"tab\">       ");
        buf.append(System.getProperty("line.separator"));
        buf.append("                <thead >      ");
        buf.append(System.getProperty("line.separator"));
        buf.append("                      <tr>");
        buf.append(System.getProperty("line.separator"));
        buf.append("                            <th colspan=\"3\" style=\"font-size:14px; text-shadow:700;    text-align: left;\">modify</th>    ");
        buf.append(System.getProperty("line.separator"));
        buf.append("                      </tr>       ");
        buf.append(System.getProperty("line.separator"));
        buf.append("                </thead>      ");
        buf.append(System.getProperty("line.separator"));
        buf.append("                <tbody>       ");
               
        buf.append(content);
       
        buf.append("                      <tr>       ");
        buf.append(System.getProperty("line.separator"));
        buf.append("                        <td colspan=\"3\" class=\"two\" align=\"center\">");
        buf.append(System.getProperty("line.separator"));
        buf.append("                            <input type=\"button\" class=\"ui-button-exp\" value=\"save\" onclick=\"save();\"/>&nbsp;                                                                             ");
        buf.append(System.getProperty("line.separator"));
        buf.append("                            <input type=\"button\" class=\"ui-button-exp\" value=\"cancle\" onclick=\"cancle();\"/>&nbsp;");
        buf.append(System.getProperty("line.separator"));
        buf.append("                            <input type=\"reset\" class=\"ui-button-exp\" value=\"reset\" />&nbsp;                                    ");
        buf.append(System.getProperty("line.separator"));
        buf.append("                        </td>      ");
        buf.append(System.getProperty("line.separator"));
        buf.append("                      </tr>  ");
        buf.append(System.getProperty("line.separator"));
        buf.append("             </tbody>      ");
        buf.append(System.getProperty("line.separator"));
        buf.append("          </table>");
        buf.append(System.getProperty("line.separator"));
        buf.append("    </form>");
        buf.append(System.getProperty("line.separator"));
        
        return buf.toString();
    }
    
    public static String getModifyContent(List<TableProperties> list)
    {
        StringBuffer buf = new StringBuffer();
        buf.append(System.getProperty("line.separator"));
        for(int i=0;i<list.size();i++)
        {
            buf.append("                      <tr>");
            buf.append(System.getProperty("line.separator"));
            buf.append("                        <td class=\"one\">"+list.get(i).getField()+":</td>  ");
            buf.append(System.getProperty("line.separator"));
            buf.append("                        <td colspan=\"2\" class=\"two\"><input type=\"text\" id=\""+list.get(i).getField()+"\" name=\""+list.get(i).getField()+"\"  class=\"validate[optional,custom[integer]]\" value=\"${bean."+list.get(i).getField()+"}\" /></td>    ");
            buf.append(System.getProperty("line.separator"));
            buf.append(System.getProperty("line.separator"));
            buf.append("                      </tr>  ");
        }
        buf.append(System.getProperty("line.separator"));
       
        return buf.toString();
    }
    
    public static String getAddScript(String tableName)
    {
        StringBuffer buf = new StringBuffer();
        buf.append(System.getProperty("line.separator"));
        buf.append("    $(function()");
        buf.append(System.getProperty("line.separator"));
        buf.append("    {");
        buf.append(System.getProperty("line.separator"));
        buf.append("      $(\"#queryForm\").validationEngine();");
        buf.append(System.getProperty("line.separator"));
        buf.append("      $('.ui-button-exp').button();");
        buf.append(System.getProperty("line.separator"));
        buf.append("    });");
        buf.append(System.getProperty("line.separator"));
        buf.append("    function save()");
        buf.append(System.getProperty("line.separator"));
        buf.append("    {");
        buf.append(System.getProperty("line.separator"));
        buf.append("     $(\"#queryForm\").attr(\"action\",\"<c:url value=\"/"+tableName+"/add.action\"/>\");");
        buf.append(System.getProperty("line.separator"));
        buf.append("     $(\"#queryForm\").submit();");
        buf.append(System.getProperty("line.separator"));
        buf.append("    }");
        buf.append(System.getProperty("line.separator"));
        buf.append("    function cancle()");
        buf.append(System.getProperty("line.separator"));
        buf.append("    {");
        buf.append(System.getProperty("line.separator"));
        buf.append("     location.href = '<c:url value=\"init"+tableName+".action\"/>';");
        buf.append(System.getProperty("line.separator"));
        buf.append("    }           ");
        buf.append(System.getProperty("line.separator"));
        
        return buf.toString();
    }
    
    public static String getAddBody(String content)
    {
        StringBuffer buf = new StringBuffer();
        buf.append(System.getProperty("line.separator"));
        buf.append("      <form id=\"queryForm\" name=\"queryForm\" method=\"post\" action=\"\">  ");
        buf.append(System.getProperty("line.separator"));
        buf.append("          <table width=\"100%\" id=\"tab\">       ");
        buf.append(System.getProperty("line.separator"));
        buf.append("                <thead >      ");
        buf.append(System.getProperty("line.separator"));
        buf.append("                      <tr>");
        buf.append(System.getProperty("line.separator"));
        buf.append("                            <th colspan=\"3\" style=\"font-size:14px; text-shadow:700;    text-align: left;\">add</th>    ");
        buf.append(System.getProperty("line.separator"));
        buf.append("                      </tr>       ");
        buf.append(System.getProperty("line.separator"));
        buf.append("                </thead>      ");
        buf.append(System.getProperty("line.separator"));
        buf.append("                <tbody>       ");
        buf.append(System.getProperty("line.separator"));
        buf.append(content);
        buf.append(System.getProperty("line.separator"));
        buf.append("                      <tr>       ");
        buf.append(System.getProperty("line.separator"));
        buf.append("                            <td colspan=\"3\" class=\"two\" align=\"center\">");
        buf.append(System.getProperty("line.separator"));
        buf.append("                                <input type=\"button\" class=\"ui-button-exp\" value=\"save\" onclick=\"save();\"/>&nbsp;                                                                             ");
        buf.append(System.getProperty("line.separator"));
        buf.append("                                <input type=\"button\" class=\"ui-button-exp\" value=\"cancle\" onclick=\"cancle();\"/>&nbsp;");
        buf.append(System.getProperty("line.separator"));
        buf.append("                                <input type=\"reset\" class=\"ui-button-exp\" value=\"reset\" />&nbsp;      ");
        buf.append(System.getProperty("line.separator"));
        buf.append("                            </td>      ");
        buf.append(System.getProperty("line.separator"));
        buf.append("                      </tr>  ");
        buf.append(System.getProperty("line.separator"));
        buf.append("             </tbody>      ");
        buf.append(System.getProperty("line.separator"));
        buf.append("          </table>");
        buf.append(System.getProperty("line.separator"));
        buf.append("    </form>");
        buf.append(System.getProperty("line.separator"));
        
        return buf.toString();
    }
    
    public static String getAddContent(List<TableProperties> list)
    {
        StringBuffer buf = new StringBuffer();
        buf.append(System.getProperty("line.separator"));
        for(int i=0;i<list.size();i++)
        {
            buf.append("                      <tr>");
            buf.append(System.getProperty("line.separator"));
            buf.append("                        <td class=\"one\">"+list.get(i).getField()+":</td>  ");
            buf.append(System.getProperty("line.separator"));
            buf.append("                        <td colspan=\"2\" class=\"two\"><input type=\"text\" id=\""+list.get(i).getField()+"\" name=\""+list.get(i).getField()+"\"  class=\"validate[optional,custom[integer]]\" value=\"\" /></td>    ");
            buf.append(System.getProperty("line.separator"));
            buf.append(System.getProperty("line.separator"));
            buf.append("                      </tr>  ");
        }
        buf.append(System.getProperty("line.separator"));
       
        return buf.toString();
    }
}
